//#include <base.js>
//#include <openlayersExt.js>
//#include <event.js>


/**
* 
* Oggetto per la creazione dell'inerterfaccia grafica
* 
* @namespace CWN2
* @class UIBuilder
* 
*/ 

CWN2.UIBuilder = {

	/**
	* 
	* Build the interface
	* 
	* @method build
	* 
	* @param {String} div Name of the div   
	* 
	*/ 
	
	build: function(div) {
		
		if(CWN2.base.DEBUG) {
			console.log('CWN2.UIBuilder');
		} 

		// Costruisco la mappa
		CWN2.MapBuilder.build(div);

		// Configuro e costruisco il container con i vari panel
	    var container = CWN2.ContainerBuilder.build(div);

		// carico i widgets
		this.loadWidgets();

		// costruisco la window per l'help
		this.buildHelpWindow();

	},
	
	/**
	* 
	* Load the widgets
	* 
	* @method loadWidgets
	* 
	* 
	*/ 
	
	loadWidgets: function() {

		var widgets = CWN2.configuration.widgets;
		var len = widgets.length;
		for (var i = 0; i < len; i++) {
			if (widgets[i].type === "widget") {
				CWN2.widgetFactory.create(widgets[i])
			}
		}
	},

	/**
	* 
	* Build the Help window
	* 
	* @method buildHelpWindow
	* 
	* 
	*/ 
	
	buildHelpWindow: function() {

		new Ext.Window({
	        title: "Help",
			id: "help-win",
	        height: 400,
	        width: 600,
	        layout: "fit",
	        closeAction: "hide",
	        items: []
	    });
		
	}
		
	
};